package com.yjhb.android.sbz.mvp.redpackdetail;

import com.yjhb.android.sbz.entity.RedPackItem;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;
import com.jojo.android.zxlib.base.mvp.CommonView;

import java.util.List;

/**
 * 创建者 zx
 * 创建时间 2021/1/14 16:33
 */
public class RedPackDetailPresenter extends ConventionPresenter<CommonView<List<RedPackItem>>> {
    private final String TAG = "RedPackDetailPresenter";

    public RedPackDetailPresenter(CommonView<List<RedPackItem>> redPackDetailBaseView) {
        super(redPackDetailBaseView);
    }

    @Override
    protected void onDestroy() {

    }

    public void listPullHistory(Integer taskId) {
        if (view != null) {
            view.onWait();
        }
        HttpTool.request(model.listPullHistory(taskId), new HttpObserver<List<RedPackItem>>() {
            @Override
            public void onResult(List<RedPackItem> data) {
                if (view != null) {
                    view.onSuccess(data);
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }
}
